using System;
using UnityEngine;

[Serializable]
public class healthbar : MonoBehaviour
{
	public Texture2D[] frames;

	public spin spin;

	public int health;

	public int speed;

	public int originalspeed;

	public GUITexture tx;

	public healthbar()
	{
		health = 1;
	}

	public void Start()
	{
		tx = gameObject.GetComponent<GUITexture>();
	}

	public void healthc()
	{
		speed = spin.speed;
		if (speed == originalspeed)
		{
			tx.texture = frames[0];
		}
		if (!((float)speed >= (float)originalspeed * 0.99f) && !((float)speed <= (float)originalspeed * 0.98f))
		{
			tx.texture = frames[1];
		}
		if (!((float)speed >= (float)originalspeed * 0.98f) && !((float)speed <= (float)originalspeed * 0.97f))
		{
			tx.texture = frames[2];
		}
		if (!((float)speed >= (float)originalspeed * 0.97f) && !((float)speed <= (float)originalspeed * 0.96f))
		{
			tx.texture = frames[3];
		}
		if (!((float)speed >= (float)originalspeed * 0.96f) && !((float)speed <= (float)originalspeed * 0.95f))
		{
			tx.texture = frames[4];
		}
		if (!((float)speed >= (float)originalspeed * 0.95f) && !((float)speed <= (float)originalspeed * 0.94f))
		{
			tx.texture = frames[5];
		}
		if (!((float)speed >= (float)originalspeed * 0.94f) && !((float)speed <= (float)originalspeed * 0.93f))
		{
			tx.texture = frames[6];
		}
		if (!((float)speed >= (float)originalspeed * 0.93f) && !((float)speed <= (float)originalspeed * 0.92f))
		{
			tx.texture = frames[7];
		}
		if (!((float)speed >= (float)originalspeed * 0.92f) && !((float)speed <= (float)originalspeed * 0.91f))
		{
			tx.texture = frames[8];
		}
		if (!((float)speed >= (float)originalspeed * 0.91f) && !((float)speed <= (float)originalspeed * 0.9f))
		{
			tx.texture = frames[9];
		}
		if (!((float)speed >= (float)originalspeed * 0.9f) && !((float)speed <= (float)originalspeed * 0.89f))
		{
			tx.texture = frames[10];
		}
		if (!((float)speed >= (float)originalspeed * 0.89f) && !((float)speed <= (float)originalspeed * 0.88f))
		{
			tx.texture = frames[11];
		}
		if (!((float)speed >= (float)originalspeed * 0.88f) && !((float)speed <= (float)originalspeed * 0.87f))
		{
			tx.texture = frames[12];
		}
		if (!((float)speed >= (float)originalspeed * 0.87f) && !((float)speed <= (float)originalspeed * 0.86f))
		{
			tx.texture = frames[13];
		}
		if (!((float)speed >= (float)originalspeed * 0.86f) && !((float)speed <= (float)originalspeed * 0.85f))
		{
			tx.texture = frames[14];
		}
		if (!((float)speed >= (float)originalspeed * 0.85f) && !((float)speed <= (float)originalspeed * 0.84f))
		{
			tx.texture = frames[15];
		}
		if (!((float)speed >= (float)originalspeed * 0.84f) && !((float)speed <= (float)originalspeed * 0.83f))
		{
			tx.texture = frames[16];
		}
		if (!((float)speed >= (float)originalspeed * 0.83f) && !((float)speed <= (float)originalspeed * 0.82f))
		{
			tx.texture = frames[17];
		}
		if (!((float)speed >= (float)originalspeed * 0.82f) && !((float)speed <= (float)originalspeed * 0.81f))
		{
			tx.texture = frames[18];
		}
		if (!((float)speed >= (float)originalspeed * 0.81f) && !((float)speed <= (float)originalspeed * 0.8f))
		{
			tx.texture = frames[19];
		}
		if (!((float)speed >= (float)originalspeed * 0.8f) && !((float)speed <= (float)originalspeed * 0.79f))
		{
			tx.texture = frames[20];
		}
		if (!((float)speed >= (float)originalspeed * 0.79f) && !((float)speed <= (float)originalspeed * 0.78f))
		{
			tx.texture = frames[21];
		}
		if (!((float)speed >= (float)originalspeed * 0.78f) && !((float)speed <= (float)originalspeed * 0.77f))
		{
			tx.texture = frames[22];
		}
		if (!((float)speed >= (float)originalspeed * 0.77f) && !((float)speed <= (float)originalspeed * 0.76f))
		{
			tx.texture = frames[23];
		}
		if (!((float)speed >= (float)originalspeed * 0.76f) && !((float)speed <= (float)originalspeed * 0.75f))
		{
			tx.texture = frames[24];
		}
		if (!((float)speed >= (float)originalspeed * 0.75f) && !((float)speed <= (float)originalspeed * 0.74f))
		{
			tx.texture = frames[25];
		}
		if (!((float)speed >= (float)originalspeed * 0.74f) && !((float)speed <= (float)originalspeed * 0.73f))
		{
			tx.texture = frames[26];
		}
		if (!((float)speed >= (float)originalspeed * 0.73f) && !((float)speed <= (float)originalspeed * 0.72f))
		{
			tx.texture = frames[27];
		}
		if (!((float)speed >= (float)originalspeed * 0.72f) && !((float)speed <= (float)originalspeed * 0.71f))
		{
			tx.texture = frames[28];
		}
		if (!((float)speed >= (float)originalspeed * 0.71f) && !((float)speed <= (float)originalspeed * 0.7f))
		{
			tx.texture = frames[29];
		}
		if (!((float)speed >= (float)originalspeed * 0.7f) && !((float)speed <= (float)originalspeed * 0.69f))
		{
			tx.texture = frames[30];
		}
		if (!((float)speed >= (float)originalspeed * 0.69f) && !((float)speed <= (float)originalspeed * 0.68f))
		{
			tx.texture = frames[31];
		}
		if (!((float)speed >= (float)originalspeed * 0.68f) && !((float)speed <= (float)originalspeed * 0.67f))
		{
			tx.texture = frames[32];
		}
		if (!((float)speed >= (float)originalspeed * 0.67f) && !((float)speed <= (float)originalspeed * 0.66f))
		{
			tx.texture = frames[33];
		}
		if (!((float)speed >= (float)originalspeed * 0.66f) && !((float)speed <= (float)originalspeed * 0.65f))
		{
			tx.texture = frames[34];
		}
		if (!((float)speed >= (float)originalspeed * 0.65f) && !((float)speed <= (float)originalspeed * 0.64f))
		{
			tx.texture = frames[35];
		}
		if (!((float)speed >= (float)originalspeed * 0.64f) && !((float)speed <= (float)originalspeed * 0.63f))
		{
			tx.texture = frames[36];
		}
		if (!((float)speed >= (float)originalspeed * 0.63f) && !((float)speed <= (float)originalspeed * 0.62f))
		{
			tx.texture = frames[37];
		}
		if (!((float)speed >= (float)originalspeed * 0.62f) && !((float)speed <= (float)originalspeed * 0.61f))
		{
			tx.texture = frames[38];
		}
		if (!((float)speed >= (float)originalspeed * 0.61f) && !((float)speed <= (float)originalspeed * 0.6f))
		{
			tx.texture = frames[39];
		}
		if (!((float)speed >= (float)originalspeed * 0.6f) && !((float)speed <= (float)originalspeed * 0.59f))
		{
			tx.texture = frames[40];
		}
		if (!((float)speed >= (float)originalspeed * 0.59f) && !((float)speed <= (float)originalspeed * 0.58f))
		{
			tx.texture = frames[41];
		}
		if (!((float)speed >= (float)originalspeed * 0.58f) && !((float)speed <= (float)originalspeed * 0.57f))
		{
			tx.texture = frames[42];
		}
		if (!((float)speed >= (float)originalspeed * 0.57f) && !((float)speed <= (float)originalspeed * 0.56f))
		{
			tx.texture = frames[43];
		}
		if (!((float)speed >= (float)originalspeed * 0.56f) && !((float)speed <= (float)originalspeed * 0.55f))
		{
			tx.texture = frames[44];
		}
		if (!((float)speed >= (float)originalspeed * 0.55f) && !((float)speed <= (float)originalspeed * 0.54f))
		{
			tx.texture = frames[45];
		}
		if (!((float)speed >= (float)originalspeed * 0.54f) && !((float)speed <= (float)originalspeed * 0.53f))
		{
			tx.texture = frames[46];
		}
		if (!((float)speed >= (float)originalspeed * 0.53f) && !((float)speed <= (float)originalspeed * 0.52f))
		{
			tx.texture = frames[47];
		}
		if (!((float)speed >= (float)originalspeed * 0.52f) && !((float)speed <= (float)originalspeed * 0.51f))
		{
			tx.texture = frames[48];
		}
		if (!((float)speed >= (float)originalspeed * 0.51f) && !((float)speed <= (float)originalspeed * 0.5f))
		{
			tx.texture = frames[49];
		}
		if (!((float)speed >= (float)originalspeed * 0.5f) && !((float)speed <= (float)originalspeed * 0.49f))
		{
			tx.texture = frames[50];
		}
		if (!((float)speed >= (float)originalspeed * 0.49f) && !((float)speed <= (float)originalspeed * 0.48f))
		{
			tx.texture = frames[51];
		}
		if (!((float)speed >= (float)originalspeed * 0.48f) && !((float)speed <= (float)originalspeed * 0.47f))
		{
			tx.texture = frames[52];
		}
		if (!((float)speed >= (float)originalspeed * 0.47f) && !((float)speed <= (float)originalspeed * 0.46f))
		{
			tx.texture = frames[53];
		}
		if (!((float)speed >= (float)originalspeed * 0.46f) && !((float)speed <= (float)originalspeed * 0.45f))
		{
			tx.texture = frames[54];
		}
		if (!((float)speed >= (float)originalspeed * 0.45f) && !((float)speed <= (float)originalspeed * 0.44f))
		{
			tx.texture = frames[55];
		}
		if (!((float)speed >= (float)originalspeed * 0.44f) && !((float)speed <= (float)originalspeed * 0.43f))
		{
			tx.texture = frames[56];
		}
		if (!((float)speed >= (float)originalspeed * 0.43f) && !((float)speed <= (float)originalspeed * 0.42f))
		{
			tx.texture = frames[57];
		}
		if (!((float)speed >= (float)originalspeed * 0.42f) && !((float)speed <= (float)originalspeed * 0.41f))
		{
			tx.texture = frames[58];
		}
		if (!((float)speed >= (float)originalspeed * 0.41f) && !((float)speed <= (float)originalspeed * 0.4f))
		{
			tx.texture = frames[59];
		}
		if (!((float)speed >= (float)originalspeed * 0.4f) && !((float)speed <= (float)originalspeed * 0.39f))
		{
			tx.texture = frames[60];
		}
		if (!((float)speed >= (float)originalspeed * 0.39f) && !((float)speed <= (float)originalspeed * 0.38f))
		{
			tx.texture = frames[61];
		}
		if (!((float)speed >= (float)originalspeed * 0.38f) && !((float)speed <= (float)originalspeed * 0.37f))
		{
			tx.texture = frames[62];
		}
		if (!((float)speed >= (float)originalspeed * 0.37f) && !((float)speed <= (float)originalspeed * 0.36f))
		{
			tx.texture = frames[63];
		}
		if (!((float)speed >= (float)originalspeed * 0.36f) && !((float)speed <= (float)originalspeed * 0.35f))
		{
			tx.texture = frames[64];
		}
		if (!((float)speed >= (float)originalspeed * 0.35f) && !((float)speed <= (float)originalspeed * 0.34f))
		{
			tx.texture = frames[65];
		}
		if (!((float)speed >= (float)originalspeed * 0.34f) && !((float)speed <= (float)originalspeed * 0.33f))
		{
			tx.texture = frames[66];
		}
		if (!((float)speed >= (float)originalspeed * 0.33f) && !((float)speed <= (float)originalspeed * 0.32f))
		{
			tx.texture = frames[67];
		}
		if (!((float)speed >= (float)originalspeed * 0.32f) && !((float)speed <= (float)originalspeed * 0.31f))
		{
			tx.texture = frames[68];
		}
		if (!((float)speed >= (float)originalspeed * 0.31f) && !((float)speed <= (float)originalspeed * 0.3f))
		{
			tx.texture = frames[69];
		}
		if (!((float)speed >= (float)originalspeed * 0.3f) && !((float)speed <= (float)originalspeed * 0.29f))
		{
			tx.texture = frames[70];
		}
		if (!((float)speed >= (float)originalspeed * 0.29f) && !((float)speed <= (float)originalspeed * 0.28f))
		{
			tx.texture = frames[71];
		}
		if (!((float)speed >= (float)originalspeed * 0.28f) && !((float)speed <= (float)originalspeed * 0.27f))
		{
			tx.texture = frames[72];
		}
		if (!((float)speed >= (float)originalspeed * 0.27f) && !((float)speed <= (float)originalspeed * 0.26f))
		{
			tx.texture = frames[73];
		}
		if (!((float)speed >= (float)originalspeed * 0.26f) && !((float)speed <= (float)originalspeed * 0.25f))
		{
			tx.texture = frames[74];
		}
		if (!((float)speed >= (float)originalspeed * 0.25f) && !((float)speed <= (float)originalspeed * 0.24f))
		{
			tx.texture = frames[75];
		}
		if (!((float)speed >= (float)originalspeed * 0.24f) && !((float)speed <= (float)originalspeed * 0.23f))
		{
			tx.texture = frames[76];
		}
		if (!((float)speed >= (float)originalspeed * 0.23f) && !((float)speed <= (float)originalspeed * 0.22f))
		{
			tx.texture = frames[77];
		}
		if (!((float)speed >= (float)originalspeed * 0.22f) && !((float)speed <= (float)originalspeed * 0.21f))
		{
			tx.texture = frames[78];
		}
		if (!((float)speed >= (float)originalspeed * 0.21f) && !((float)speed <= (float)originalspeed * 0.2f))
		{
			tx.texture = frames[79];
		}
		if (!((float)speed >= (float)originalspeed * 0.2f) && !((float)speed <= (float)originalspeed * 0.19f))
		{
			tx.texture = frames[80];
		}
		if (!((float)speed >= (float)originalspeed * 0.19f) && !((float)speed <= (float)originalspeed * 0.18f))
		{
			tx.texture = frames[81];
		}
		if (!((float)speed >= (float)originalspeed * 0.18f) && !((float)speed <= (float)originalspeed * 0.17f))
		{
			tx.texture = frames[82];
		}
		if (!((float)speed >= (float)originalspeed * 0.17f) && !((float)speed <= (float)originalspeed * 0.16f))
		{
			tx.texture = frames[83];
		}
		if (!((float)speed >= (float)originalspeed * 0.16f) && !((float)speed <= (float)originalspeed * 0.15f))
		{
			tx.texture = frames[84];
		}
		if (!((float)speed >= (float)originalspeed * 0.15f) && !((float)speed <= (float)originalspeed * 0.14f))
		{
			tx.texture = frames[85];
		}
		if (!((float)speed >= (float)originalspeed * 0.14f) && !((float)speed <= (float)originalspeed * 0.13f))
		{
			tx.texture = frames[86];
		}
		if (!((float)speed >= (float)originalspeed * 0.13f) && !((float)speed <= (float)originalspeed * 0.12f))
		{
			tx.texture = frames[87];
		}
		if (!((float)speed >= (float)originalspeed * 0.12f) && !((float)speed <= (float)originalspeed * 0.11f))
		{
			tx.texture = frames[88];
		}
		if (!((float)speed >= (float)originalspeed * 0.11f) && !((float)speed <= (float)originalspeed * 0.1f))
		{
			tx.texture = frames[89];
		}
		if (!((float)speed >= (float)originalspeed * 0.1f) && !((float)speed <= (float)originalspeed * 0.09f))
		{
			tx.texture = frames[90];
		}
		if (!((float)speed >= (float)originalspeed * 0.09f) && !((float)speed <= (float)originalspeed * 0.08f))
		{
			tx.texture = frames[91];
		}
		if (!((float)speed >= (float)originalspeed * 0.08f) && !((float)speed <= (float)originalspeed * 0.07f))
		{
			tx.texture = frames[92];
		}
		if (!((float)speed >= (float)originalspeed * 0.07f) && !((float)speed <= (float)originalspeed * 0.06f))
		{
			tx.texture = frames[93];
		}
		if (!((float)speed >= (float)originalspeed * 0.06f) && !((float)speed <= (float)originalspeed * 0.05f))
		{
			tx.texture = frames[94];
		}
		if (!((float)speed >= (float)originalspeed * 0.05f) && !((float)speed <= (float)originalspeed * 0.04f))
		{
			tx.texture = frames[95];
		}
		if (!((float)speed >= (float)originalspeed * 0.04f) && !((float)speed <= (float)originalspeed * 0.03f))
		{
			tx.texture = frames[96];
		}
		if (!((float)speed >= (float)originalspeed * 0.03f) && !((float)speed <= (float)originalspeed * 0.02f))
		{
			tx.texture = frames[97];
		}
		if (!((float)speed >= (float)originalspeed * 0.02f) && !((float)speed <= (float)originalspeed * 0.01f))
		{
			tx.texture = frames[98];
		}
		if (!((float)speed >= (float)originalspeed * 0.01f) && !((float)speed <= (float)originalspeed * 0f))
		{
			tx.texture = frames[99];
		}
		if ((float)speed == (float)originalspeed * 0f)
		{
			tx.texture = frames[100];
		}
	}

	public void getspeed()
	{
		originalspeed = spin.speed;
	}

	public void Main()
	{
		InvokeRepeating("healthc", 0f, 0.3f);
		Invoke("getspeed", 5.5f);
	}
}
